<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="moil">
<head>
    <%@include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <title>${title}</title>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <!-- 响应式设计 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript">
        (function () {
            angular.module("moil", []);
            window.AllDocCtrl = function ($scope, $rootScope) {

            }
        })();
    </script>
</head>
<body ng-controller="AllDocCtrl">
<!-- content -->
<!-- 分页显示演示开始 -->


<div class="u_child_box">
    <div class="u_title_bar">
        <span id="device_info" class="u_title">密码修改</span>
    </div>
</div>
<!-- 分页显示演示开始 -->
<style>
    #inputForm table tr th, #inputForm table tr td {
        background: #E3E6EC;
        height: 35px;
        line-height: 35px;
    }

    #inputForm table th {
        text-align: right;

    }
</style>

<div class="tab-content">
    <div class="tab-pane active">
        <form id="inputForm" class="form-inline" action="${ctx}/security/user/passwd2" method="post">
            <table style="width: 80%; margin: 60px auto;" class="table table-striped table-bordered table-condensed">
                <tr>
                    <td colspan="2"
                        style="text-align: center;height: 50px;line-height: 50px; background: none repeat scroll 0 0 #EFF2F7;padding: 15px;">
                        <span class="u_password-logo"> MDM </span>
                    </td>
                </tr>
                <tr>
                    <th width="40%">原始密码：</th>
                    <td>
                        <input type="password" name="oldpwd" id="oldpwd"/>
                        <input type="hidden" name="uid" value="${USER.id }"/>
                    </td>
                </tr>
                <tr>
                    <th>新密码：</th>
                    <td>
                        <input type="password" name="newpwd" id="newpwd"/>
                    </td>
                </tr>
                <tr>
                    <th>确认密码：</th>
                    <td>
                        <input type="password" name="passwd"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"
                        style="text-align: center; background: #E3E6EC;padding: 15px;height: 50px;line-height: 50px;">
                        <button type="submit" class="btn u_c_btn" style="width: 150px;">提 交</button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    (function () {
        angular.module("moil", []);
        window.AllDocCtrl = function ($scope, $rootScope) {

        }
    })();

    $("#inputForm").validate({
        rules: {
            oldpwd: {
                required: true,
                remote: {
                    type: "POST",
                    url: "${ctx}/security/user/isOldpwd",
                    data: {
                        oldpwd: function () {
                            return $("#oldpwd").val();
                        },
                        uid: "${USER.id}"
                    }
                }
            },
            newpwd: {
                required: true,
                minlength: 6
            },
            passwd: {
                required: true,
                equalTo: "#newpwd"
            }
        },
        messages: {
            oldpwd: {
                remote: $.format("原始密码不正确！")
            }
        }
    });
    <c:if test="${msg != null}">
    msgAlert.show("${msg}");
    </c:if>
</script>
</body>
</html>